package com.example.test1

import android.content.ComponentName
import android.content.Context
import android.content.pm.PackageManager

class IconChanger(private val context: Context) {
    fun changeIconToNew() {
        val packageManager: PackageManager = context.packageManager
        val componentName = ComponentName(context, "com.example.test1.MainActivityAlias")
        packageManager.setComponentEnabledSetting(
            componentName,
            PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
            PackageManager.DONT_KILL_APP
        )
        val oldComponentName = ComponentName(context, "com.example.test1.MainActivity")
        packageManager.setComponentEnabledSetting(
            oldComponentName,
            PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
            PackageManager.DONT_KILL_APP
        )
    }


}